package com.minelx.parallel;

import java.util.function.Function;

public class Mapper<T, R> {
	private final Reducer<R, ?> reducer;

	private final Function<T, R> mapper;

	public Mapper(Reducer<R, ?> reducer, Function<T, R> mapper) {
		this.reducer = reducer;
		this.mapper = mapper;
	}

	public void map(T from) {
		reducer.append(mapper.apply(from));
	}
}
